<template>
  <div :class="$style.container">
    <div :class="$style.left" @click.stop="handleAllClick()">
      <i v-if="all" :class="['iconfont', 'icon-iconset0126',$style.icon,$style.selected]"/>
      <i  v-else :class="['iconfont', 'icon-circle',$style.icon]"/>
      <span :class="$style.allText">全选</span>
      <span :class="$style.total">合计:￥{{total.toFixed(2)}}</span>
    </div>
    <div :class="$style.right" @click.stop="$emit('submit')">
      <span :class="total > 0 ? [$style.btn,$style.active] : $style.btn">去结算</span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    all: {
      type: Boolean,
      default: false
    },
    total: {
      type: Number,
      default: 0
    }
  },
  methods: {
    handleAllClick () {
      if (this.all) {
        this.$emit('isAll', false)
      } else {
        this.$emit('isAll', true)
      }
    }
  }
}
</script>

<style lang='less' module>
.container {
  // position: absolute;
  // bottom:0;
  // left:0;
  // right:0;
  height:50px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -4px 8px 0 rgba(0,0,0,.1);
  .left {
    margin-left:10px;
    .icon {
      font-size:20px;
      color:#B7BBBF;
    }
    .selected {
      color:#20CC85;
      font-weight: bold;
    }
    .allText {
      margin-left: 17px;
      font-size: 14px;
      color: #71777D;
    }
    .total {
      margin-left: 20px;
      font-weight: 500;
      font-size: 16px;
      color: #2B333B;
    }
  }
  .right {
    .btn {
      display: inline-block;
      width: 122px;
      height:40px;
      line-height: 40px;
      text-align: center;
      border-radius: 20px;
      color:#fff;
      background: #B7BBBF;
    }
    .active {
      background: #F01414;
    }
  }
}

</style>